import React, { useEffect, useState } from "react";
import axios from "../../http/axios";
import style from "./index.module.scss";
import { useNavigate } from "react-router-dom";
import { ShareO, Chat, GoodJob } from "@react-vant/icons";
import WithRouter from "../../components/HOC/WithRouter";
const Index: React.FC = () => {
  const navigate = useNavigate();
  const [itemData, setItemData] = React.useState([]);
  const getlist = async () => {
    const res = await axios.get("/api/date");
    const { data } = res.data;
    const newdata = data.filter((item: any) => {
      return item.flag == true;
    });
    console.log(newdata);
    setItemData(newdata);
  };
  useEffect(() => {
    getlist();
  }, []);
  const tz = () => {
    navigate("/kepuhaomyzan");
  };
  return (
    <div>
      <div className={style.list}>
        <h2>消息</h2>
        <div className={style.messageitem} onClick={()=>tz()}>
          <span>赞过的内容 ({itemData.length}条)</span>
          <span>&gt;</span>
        </div>
        <div className={style.messageitem} onClick={()=>tz()}>
          <span>收藏的内容  ({itemData.length}条)</span>
          <span>&gt;</span>
        </div>
        <div className={style.messageitem}>
          <span>评论的内容</span>
          <span>&gt;</span>
        </div>
        <div className={style.messageitem}>
          <span>直播义诊内容</span>
          <span>&gt;</span>
        </div>
      </div>
    </div>
  );
};

export default WithRouter(Index);
